import unittest,time
from selenium import webdriver
from mission_7_30_1.Page.Page1 import Page1
from mission_7_30_1.Page.Page2 import Page2
from mission_7_30_1.Data.db import Data
class Case(unittest.TestCase):
    # 测试固件
    def setUp(self):
        self.driver=webdriver.Edge()
        self.driver.maximize_window()
        self.sql=Data()
    def tearDown(self):
        time.sleep(5)
        self.driver.quit()
    # 测试用例
    def test_A3mall_01_login(self):
        po = Page1(self.driver)
        po.A3mall_login()
        ye1=po.dy2()
        ye=self.sql.select('select amount from mall_users where username = "13811033962"')
        print(ye[0][0])
        self.assertEqual(float(ye[0][0]),float(ye1))


    def test_A3mall_02_search(self):
        po=Page2(self.driver)
        po.A3mall_search()
        dy41=po.dy4()
        dj=self.sql.select('select sell_price from mall_goods where title = "手机BBBBB"')
        print(dj[0][0])
        self.assertEqual(float(dj[0][0]),float(dy41))



if __name__ == '__main__':
    unittest.main()
